package edu.towson.greenteam.command;

import edu.towson.greenteam.InformationAggregator;
import edu.towson.greenteam.Iterator;
import edu.towson.greenteam.menu.Menu;
import edu.towson.greenteam.menu.MenuItem;

public class CMDMenuByPrice implements Command {
	
	InformationAggregator ia;
	float price;
	
	public CMDMenuByPrice(InformationAggregator ia, float price) {
		this.ia = ia;
		this.price = price;
	}
	
	public Object execute() {
		Menu newMenuByPrice = new Menu();
		Menu currentMenu = ia.getMenu();
		Iterator<MenuItem> i = currentMenu.getMenuPriceItr(price);
		while (i.hasNext()) {
			newMenuByPrice.add(i.next());
		}
		return newMenuByPrice;
	}

}
